import gtk, frame, text

class timeline(gtk.EventBox):
    def __init__(self, text="Nothing"):
        gtk.EventBox.__init__(self)
        self.HBox=gtk.HBox(spacing=1)
        self.add(self.HBox)
        self.label=gtk.Label(text)
        self.label.set_size_request(50, 48)
        self.HBox.pack_start(self.label, False)
        
        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#7F7F7F"))
        
    
    def add_frame(self, widget):
        #print widget
        if isinstance(widget, frame.frame):
            widget.show_all()
            self.HBox.pack_start(widget, False, False)
        else: print "this is not a frame"
        self.HBox.show_all()
        self.show_all()

    def add_txt(self, widget):
        #print widget
        if isinstance(widget, text.text):
            widget.show_all()
            self.HBox.pack_start(widget, False, False)
        else: print "this is not a text"
        self.HBox.show_all()
        self.show_all()

    
    def remove_frame(self, widget):
        self.HBox.remove(widget)
    
    def get_children(self):
        return self.HBox.get_children()
    
    def clear(self):
        for child in self.get_children():
            self.remove_frame(child)
        
        self.HBox.pack_start(self.label, False)